﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DapperDal.DapperBase
{
    /// <summary>
    /// 
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    /// <typeparam name="TPrimary"></typeparam>
    public interface IDapperBaseDAL<TPrimary, TEntity> where TEntity : class, new()
    {
        /// <summary>
        /// 新增一条数
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        TPrimary Insert(TEntity entity);

        /// <summary>
        /// 批量添加数据
        /// </summary>
        /// <param name="list"></param>
        void Insert(IEnumerable<TEntity> list);

        /// <summary>
        /// 根据主键获取实体
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        TEntity GetSingle(TPrimary id);

        /// <summary>
        /// 逻辑删除，需要自己实现自己的逻辑
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        bool SoftDelete(TPrimary id);

        /// <summary>
        /// 修改数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        bool Update(TEntity entity);
    }
}
